package book.discount
import io.github.talelin.latticy.bo.OrderVO2
import java.math.BigDecimal;

global io.github.talelin.latticy.service.impl.AccuracyServiceImpl accuracyService

rule "rule_${(userId)}_${(ruleName)!"默认规则名称"}"
    when
    $order:OrderVO2(
    <#list conditionList as condition>
        <#if condition.logical ?exists>${condition.logical}</#if>
        ${condition.field} ${(condition.symbol)} ${(condition.fieldValue)}
    </#list>
    )
    then
        $order.setRealPrice(${(baseCost)}
            <#list resultList as result>
                + accuracyService.thresholdLimit($order.get${result.field}(),${(result.fieldValue)},${(result.min)},${(result.max)},${(result.accuracy)})
            </#list>
        );
end